﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThucThe;
using System.Data;
namespace KetNoi
{
    public class NhaHang_ketnoi
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable danhSachNhaHang()
        {
            return kn.LayDuLieu("NhaHang_load");
        }
        public int Them_NhaHang(NhaHang_thucthe nh)
        {
            int Nparameter = 5;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenNhaHang"; value[0] = nh.TenNhaHang;
            name[1] = "@diaChi"; value[1] = nh.DiaChi;
            name[2] = "@email"; value[2] = nh.Email;
            name[3] = "@sdt"; value[3] = nh.Sdt;
            name[4] = "@moTa"; value[4] = nh.MoTa;
            return kn.CapNhat("NhaHang_them", name, value, Nparameter);
        }
        public int Sua_NhaHang(NhaHang_thucthe nh)
        {
            int Nparameter = 6;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maNhaHang"; value[0] = nh.MaNhaHang;
            name[1] = "@tenNhaHang"; value[1] = nh.TenNhaHang;
            name[2] = "@diaChi"; value[2] = nh.DiaChi;
            name[3] = "@email"; value[3] = nh.Email;
            name[4] = "@sdt"; value[4] = nh.Sdt;
            name[5] = "@moTa"; value[5] = nh.MoTa;
            return kn.CapNhat("NhaHang_sua", name, value, Nparameter);
        }
        public int Xoa_NhaHang(NhaHang_thucthe nh)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maNhaHang";
            value[0] = nh.MaNhaHang;
            return kn.CapNhat("NhaHang_xoa", name, value, Nparameter);
        }
        public DataTable Tim_NhaHang(NhaHang_thucthe nh)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenNhaHang";
            value[0] = nh.TenNhaHang;
            return kn.TimKiem("NhaHang_tim", name, value, Nparameter);
        }
    }
}
